package main.java.cn.zjgsu.action;
import java.util.Map;



import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;





import main.java.cn.zjgsu.domain.Student;
import main.java.cn.zjgsu.service.*;

public class Login extends ActionSupport {
    
	Service service=new Service();
	 private String username;
     private String password;
 
     public String getUsername() {
      return username;
     }
     public void setUsername(String username) {
      this.username = username;
     }
     public String getPassword() {
      return password;
     }
     public void setPassword(String password) {
      this.password = password;
     }
    
	public String execute() throws Exception{
		 
		Student student=service.login(username,password);;
		// service.login(username,password);
		if(student!=null)
		{
			
			ActionContext actionContext = ActionContext.getContext();   
			Map session = actionContext.getSession();        
			session.put("no",username);
			return SUCCESS;
		}
		else{
			
			return ERROR;
		}
	
		
	}
	
}
